package org.openea.eap.module.obpm.service.form.impl;

import org.openbpm.base.api.query.QueryFilter;
import org.openbpm.base.api.query.QueryOP;
import org.openbpm.base.db.model.query.DefaultQueryFilter;
import org.openbpm.base.manager.impl.BaseManager;
import org.openea.eap.module.obpm.dao.form.FormCombinateDialogDao;
import org.openea.eap.module.obpm.model.form.FormCombinateDialog;
import org.openea.eap.module.obpm.service.form.FormCombinateDialogManager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;







@Service("combinateDialogManager")
public class FormCombinateDialogManagerImpl
  extends BaseManager<String, FormCombinateDialog>
  implements FormCombinateDialogManager
{
  @Resource
  FormCombinateDialogDao combinateDialogDao;

  public FormCombinateDialog getByAlias(String alias) {
    DefaultQueryFilter defaultQueryFilter = new DefaultQueryFilter();
    defaultQueryFilter.addFilter("alias_", alias, QueryOP.EQUAL);
    List<FormCombinateDialog> combinateDialogs = query((QueryFilter)defaultQueryFilter);
    if (combinateDialogs == null || combinateDialogs.isEmpty())
      return null;
    return combinateDialogs.get(0);
  }
}
